import {useEffect, useState} from 'react';
import {SysDicModel} from "@/pages/sys/dic/data";
import service from "@/pages/sys/dic/service";

/** 详情操作组件 */
function useDicListByCategoryCode(dicCode: string): SysDicModel[] {
  const [data, setData] = useState<SysDicModel[]>([]);

  /** 根据字典编码加载字典列表 */
  useEffect(() => {
    service.selectListByCategoryCode(dicCode).then(result => {
      setData(result.data);
    });
  }, []);

  return data;
}

export default useDicListByCategoryCode;
